package com.program.cloudmanage.tripteam.persistence;

import com.program.cloudmanage.tripteam.domain.TripTeam;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface TripTeamMapper {
    @Select("select * from tripteam")
    List<TripTeam> showTripTeam();
    @Select("select * from tripteam where tripteam.teamid = #{id}")
    TripTeam searchTripTeam(String teamid);
    @Select("SELECT * from tripteam where tripteam.teamname LIKE CONCAT('%', #{name},'%')")
    List<TripTeam> searchTripTeamByName(String name);
    @Insert("insert into tripteam(teamname,teamid,intelligence,credit) values (#{teamname},#{teamid},#{intelligence},#{credit})")
    void insertTripTeam(@Param("teamid") String teamid,@Param("teamname") String teamname,@Param("intelligence") String intelligence,@Param("credit") String credit);
    @Delete("delete from tripteam where teamid = #{teamid}")
    void deleteTripTeam(String teamid);
     @Update("update tripteam set teamname=#{teamname},intelligence=#{intelligence},credit=#{credit} where teamid=#{teamid}")
    void updateTripTeam(@Param("teamid") String teamid,@Param("teamname")String teamname,@Param("intelligence")String intelligence,@Param("credit")String credit);
     @Update("update tripteam set credit=#{credit} where teamid=#{teamid}")
    void updateCredit(@Param("teamid")String teamid,@Param("credit")String credit);
}
